package com.ls.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ls.blog.vo.ArchiveVo;
import com.ls.blog.entity.Article;
import com.ls.blog.vo.ArchiveRecord;
import com.ls.blog.vo.ArticleVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @program: myblog
 * @author: lishun
 * @create: 2021-07-04 22:58
 **/
public interface ArticleMapper extends BaseMapper<Article> {

    /**
     * 文章归档
     * @return
     */
    List<ArchiveRecord> listArchives(Page page);

    /**
     * 根据年月查询归档
     * @param year
     * @param month
     * @return
     */
    List<ArchiveVo> findArchives(@Param("year") Integer year, @Param("month") Integer month);

    /**
     * 根据文章id增加评论数量
     * @param articleId
     */
    void addCommentCountsByArticleId(@Param("articleId")Long articleId);

    List<ArticleVo> listArticle(Page page,
                                @Param("tagId")Long tagId,
                                @Param("categoryId") Long categoryId);
}
